import React, { lazy, Suspense } from 'react';
import { createBrowserRouter } from 'react-router-dom';
import Demo from '../pages/Demo';
import NotFound from '../components/NotFound';
import PageLayout from '../components/PageLayout';
import { getViewComponent, getLayoutComponent } from '../utils/router';
const Login = lazy(getViewComponent('Login'));
const BasicLayout = lazy(getLayoutComponent());
const defineRouter = createBrowserRouter([
  {
    path: '/',
    element: (
      <Suspense>
        <BasicLayout />
      </Suspense>
    ),
    children: [{}],
  },
  {
    path: '/login',
    element: (
      <Suspense>
        <Login />
      </Suspense>
    ),
  },
  { path: '/about', element: <Demo /> },
  {
    path: '*',
    Component: NotFound,
  },
]);

export default defineRouter;
